// 车辆版本管理模块api
import { axios } from '@/utils/request'
// 获取车辆版本分页数据
function getVehicleVersionPageData (query, versionType) {
  return axios({
    url: '/software-service/vehicleVersion/' + versionType.toLowerCase() + '/list',
    method: 'get',
    params: query
  })
}

// 添加车辆版本数据
function addVehicleVersionData (data,versionType) {
  return axios({
    url: '/software-service/vehicleVersion/' + versionType.toLowerCase(),
    method: 'post',
    data
  })
}

// 编辑车辆版本数据
function editVehicleVersionData (data, versionType) {
  return axios({
    url: '/software-service/vehicleVersion/' + versionType.toLowerCase(),
    method: 'put',
    data
  })
}

// 删除车辆版本数据
function deleteVehicleVersionData (data, versionType) {
  return axios({
    url: '/software-service/vehicleVersion/' + versionType.toLowerCase(),
    method: 'delete',
    data
  })
}

// 获取车辆版本下拉数据
function getVehicleVersionSelectData (query, versionType) {
  return axios({
    url: '/software-service/vehicleVersion/' + versionType.toLowerCase() + '/select',
    method: 'get',
    params: query
  })
}
// 获取车辆版本名称下拉框
function getVehicleVersionNameSelect (query, versionType) {
  return axios({
    url: '/software-service/vehicleVersion/' + versionType.toLowerCase() + '/select/name',
    method: 'get',
    params: query
  })
}

// 获取指定车辆版本的详情
function getVehicleVersionDetailById (id, versionType) {
  return axios({
    url: '/software-service/vehicleVersion/' + versionType.toLowerCase() + '/info',
    method: 'get',
    params: {
      id
    }
  })
}
// 根据版本id查询该版本的全量包和差分包数量
function getPackageCounVersionId (id) {
  return axios({
    url: '/software-service/version/package/count',
    method: 'get',
    params: {
      id
    }
  })
}

// 获取最新的测试版本号
function getNextVehicleVersion () {
  return axios({
    url: '/software-service/vehicleVersion/nextTestVehicleVersion',
    method: 'get'
  })
}

export default {
  getVehicleVersionPageData,
  addVehicleVersionData: addVehicleVersionData,
  editVehicleVersionData,
  getVehicleVersionDetailById:getVehicleVersionDetailById,
  deleteVehicleVersionData,
  getVehicleVersionSelectData:getVehicleVersionSelectData,
  getVehicleVersionNameSelect:getVehicleVersionNameSelect,
  getPackageCounVersionId,
  getNextVehicleVersion
}
